#!/bin/bash
# shellcheck source=meta-facebook/meta-harma/recipes-phosphor/gpio/phosphor-gpio-monitor/device-util
source /usr/libexec/phosphor-gpio-monitor/device-util

# shellcheck source=meta-facebook/meta-harma/recipes-phosphor/gpio/phosphor-gpio-monitor/auto-power
source /usr/libexec/phosphor-gpio-monitor/auto-power

# End the script if the FRU version is DVT1 and triggered by SGPIO18
if ! check-auto-power-condition "$1"; then
    exit 0
fi

mb_power_lose_reprobe

busctl call xyz.openbmc_project.FruDevice \
  /xyz/openbmc_project/FruDevice \
  xyz.openbmc_project.FruDeviceManager \
  ReScan
